<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    class Person {
      constructor(uname, age) {
        this.uname = uname
        this.age = age
      }
      sayHi() {
        console.log(`我是${this.uname},今年${this.age}`)
      }
    }

    class Teacher extends Person {
      constructor(uname, age, coures) {
        super(uname, age)
        this.coures = coures
      }
      teach() {
        console.log(`我是${this.uname}是一个敲代码的,今年${this.age},学${this.coures}`)
      }
    }
    const zp = new Teacher('曾鹏', 18, '前端')
    console.log(zp)
    zp.sayHi()
    zp.teach()
  </script>
</body>

</html>